{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "from tensorflow import keras\n",
    "import matplotlib.pyplot as plt\n",
    "%matplotlib inline"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "import tensorflow.keras.datasets.mnist as mnist"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "(train_image,train_label),(test_image,test_label) = mnist.load_data()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(60000, 28, 28)"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "train_image.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.image.AxesImage at 0x1a588713cf8>"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAP8AAAD8CAYAAAC4nHJkAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAADn9JREFUeJzt3X9sXfV5x/HPU8dxlhDauCmeSzMSIC3QsIbtKoCIgImR\npQgpoKqhUVWljDVdC3RsmQTLpjWb2JRNLVXKGJJZsyQVv0oLIn+wVmBV0GrgYbIQfpVfwV0TjE1w\nIYHSxLGf/eGTygXf73XuPfeeaz/vl2T53vOcc8+jk3x87r3fe8/X3F0A4vlA0Q0AKAbhB4Ii/EBQ\nhB8IivADQRF+ICjCDwRF+IGgCD8Q1IxG7mymtfkszWnkLoFQfq13dNgP2WTWrSn8ZrZS0mZJLZL+\nw903pdafpTk62y6qZZcAEnq8e9LrVv2038xaJN0i6dOSzpC0xsz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+6CkozNLF3rsEn0VoojwnyjpF+Pu71VzTfntkh4ysyfMbF3R\nzUygI5s2XZJek9RRZDMTqDhzcyO9Z2bppjl21cx4nTfe8Hu/5e6+VNKnJV2dPb1tSj72mq2Zhmsm\nNXNzo0wws/RvFHnsqp3xOm9FhH+fpAXj7n8sW9YU3H1f9ntQ0n1qvtmHB45Okpr9Hiy4n99oppmb\nJ5pZWk1w7Jppxusiwv+4pMVmtsjMZkr6nKQdBfTxPmY2J3sjRmY2R9IKNd/swzskrc1ur5V0f4G9\n/JZmmbm53MzSKvjYNd2M1+7e8B9Jl2jsHf+XJf1tET2U6etkSU9mP88U3ZukOzX2NHBYY++NXCXp\nw5K6Jb0o6SFJ7U3U23clPSVpt8aC1llQb8s19pR+t6Rd2c8lRR+7RF+FHDc+4QcExRt+QFCEHwiK\n8ANBEX4gKMIPBEX4gaAIPxAU4QeC+n8DZI6NXofNrQAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x1a58508fcf8>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.imshow(train_image[0])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "5"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "train_label[0]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "model = keras.Sequential()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(10000, 28, 28)"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "test_image.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "model.add(keras.layers.Flatten())\n",
    "model.add(keras.layers.Dense(64,activation='relu'))\n",
    "model.add(keras.layers.Dense(64,activation='relu'))\n",
    "model.add(keras.layers.Dropout(0.5))\n",
    "model.add(keras.layers.Dense(64,activation='relu'))\n",
    "model.add(keras.layers.Dropout(0.5))\n",
    "model.add(keras.layers.Dense(10,activation='softmax'))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "model.compile(optimizer='adam',loss='sparse_categorical_crossentropy',metrics=['acc'])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Train on 60000 samples, validate on 10000 samples\n",
      "Epoch 1/50\n",
      "60000/60000 [==============================] - 7s 112us/step - loss: 7.8554 - acc: 0.4922 - val_loss: 5.7092 - val_acc: 0.6314\n",
      "Epoch 2/50\n",
      "60000/60000 [==============================] - 1s 12us/step - loss: 3.2841 - acc: 0.7688 - val_loss: 2.3261 - val_acc: 0.8335\n",
      "Epoch 3/50\n",
      "60000/60000 [==============================] - 1s 11us/step - loss: 1.1751 - acc: 0.8948 - val_loss: 0.6768 - val_acc: 0.9238\n",
      "Epoch 4/50\n",
      "60000/60000 [==============================] - 1s 11us/step - loss: 0.5011 - acc: 0.9364 - val_loss: 0.4488 - val_acc: 0.9372\n",
      "Epoch 5/50\n",
      "60000/60000 [==============================] - 1s 12us/step - loss: 0.3601 - acc: 0.9465 - val_loss: 0.3880 - val_acc: 0.9415\n",
      "Epoch 6/50\n",
      "60000/60000 [==============================] - 1s 11us/step - loss: 0.2762 - acc: 0.9536 - val_loss: 0.3733 - val_acc: 0.9376\n",
      "Epoch 7/50\n",
      "60000/60000 [==============================] - 1s 13us/step - loss: 0.2260 - acc: 0.9589 - val_loss: 0.3155 - val_acc: 0.9448\n",
      "Epoch 8/50\n",
      "60000/60000 [==============================] - 1s 12us/step - loss: 0.1794 - acc: 0.9654 - val_loss: 0.2963 - val_acc: 0.9459\n",
      "Epoch 9/50\n",
      "60000/60000 [==============================] - 1s 13us/step - loss: 0.1521 - acc: 0.9691 - val_loss: 0.3001 - val_acc: 0.9473\n",
      "Epoch 10/50\n",
      "60000/60000 [==============================] - 1s 13us/step - loss: 0.1344 - acc: 0.9721 - val_loss: 0.2758 - val_acc: 0.9510\n",
      "Epoch 11/50\n",
      "60000/60000 [==============================] - 1s 13us/step - loss: 0.1187 - acc: 0.9746 - val_loss: 0.2779 - val_acc: 0.9472\n",
      "Epoch 12/50\n",
      "60000/60000 [==============================] - 1s 12us/step - loss: 0.1068 - acc: 0.9768 - val_loss: 0.2560 - val_acc: 0.9539\n",
      "Epoch 13/50\n",
      "60000/60000 [==============================] - 1s 13us/step - loss: 0.0875 - acc: 0.9801 - val_loss: 0.2546 - val_acc: 0.9528\n",
      "Epoch 14/50\n",
      "60000/60000 [==============================] - 1s 12us/step - loss: 0.0820 - acc: 0.9813 - val_loss: 0.2411 - val_acc: 0.9561\n",
      "Epoch 15/50\n",
      "60000/60000 [==============================] - 1s 12us/step - loss: 0.0737 - acc: 0.9823 - val_loss: 0.2424 - val_acc: 0.9541\n",
      "Epoch 16/50\n",
      "60000/60000 [==============================] - 1s 12us/step - loss: 0.0656 - acc: 0.9842 - val_loss: 0.2549 - val_acc: 0.9549\n",
      "Epoch 17/50\n",
      "60000/60000 [==============================] - 1s 12us/step - loss: 0.0635 - acc: 0.9845 - val_loss: 0.2558 - val_acc: 0.9544\n",
      "Epoch 18/50\n",
      "60000/60000 [==============================] - 1s 11us/step - loss: 0.0557 - acc: 0.9868 - val_loss: 0.2372 - val_acc: 0.9578\n",
      "Epoch 19/50\n",
      "60000/60000 [==============================] - 1s 12us/step - loss: 0.0554 - acc: 0.9864 - val_loss: 0.2536 - val_acc: 0.9551\n",
      "Epoch 20/50\n",
      "60000/60000 [==============================] - 1s 11us/step - loss: 0.0544 - acc: 0.9867 - val_loss: 0.2431 - val_acc: 0.9573\n",
      "Epoch 21/50\n",
      "60000/60000 [==============================] - 1s 12us/step - loss: 0.0534 - acc: 0.9864 - val_loss: 0.2542 - val_acc: 0.9540\n",
      "Epoch 22/50\n",
      "60000/60000 [==============================] - 1s 12us/step - loss: 0.0538 - acc: 0.9868 - val_loss: 0.2590 - val_acc: 0.9561\n",
      "Epoch 23/50\n",
      "60000/60000 [==============================] - 1s 12us/step - loss: 0.0501 - acc: 0.9875 - val_loss: 0.2673 - val_acc: 0.9559\n",
      "Epoch 24/50\n",
      "60000/60000 [==============================] - 1s 11us/step - loss: 0.0536 - acc: 0.9862 - val_loss: 0.2473 - val_acc: 0.9589\n",
      "Epoch 25/50\n",
      "60000/60000 [==============================] - 1s 12us/step - loss: 0.0435 - acc: 0.9894 - val_loss: 0.2455 - val_acc: 0.9581\n",
      "Epoch 26/50\n",
      "60000/60000 [==============================] - 1s 11us/step - loss: 0.0398 - acc: 0.9903 - val_loss: 0.2546 - val_acc: 0.9576\n",
      "Epoch 27/50\n",
      "60000/60000 [==============================] - 1s 12us/step - loss: 0.0366 - acc: 0.9912 - val_loss: 0.2473 - val_acc: 0.9609\n",
      "Epoch 28/50\n",
      "60000/60000 [==============================] - 1s 13us/step - loss: 0.0352 - acc: 0.9917 - val_loss: 0.2580 - val_acc: 0.9595\n",
      "Epoch 29/50\n",
      "60000/60000 [==============================] - 1s 12us/step - loss: 0.0527 - acc: 0.9869 - val_loss: 0.2529 - val_acc: 0.9596\n",
      "Epoch 30/50\n",
      "60000/60000 [==============================] - 1s 12us/step - loss: 0.0426 - acc: 0.9891 - val_loss: 0.2696 - val_acc: 0.9584\n",
      "Epoch 31/50\n",
      "60000/60000 [==============================] - 1s 13us/step - loss: 0.0558 - acc: 0.9861 - val_loss: 0.2578 - val_acc: 0.9587\n",
      "Epoch 32/50\n",
      "60000/60000 [==============================] - 1s 13us/step - loss: 0.0383 - acc: 0.9906 - val_loss: 0.2770 - val_acc: 0.9595\n",
      "Epoch 33/50\n",
      "60000/60000 [==============================] - 1s 12us/step - loss: 0.0443 - acc: 0.9885 - val_loss: 0.2527 - val_acc: 0.9621\n",
      "Epoch 34/50\n",
      "60000/60000 [==============================] - 1s 13us/step - loss: 0.0498 - acc: 0.9878 - val_loss: 0.2629 - val_acc: 0.9605\n",
      "Epoch 35/50\n",
      "60000/60000 [==============================] - 1s 11us/step - loss: 0.0575 - acc: 0.9861 - val_loss: 0.2535 - val_acc: 0.9603\n",
      "Epoch 36/50\n",
      "60000/60000 [==============================] - 1s 12us/step - loss: 0.0388 - acc: 0.9904 - val_loss: 0.2423 - val_acc: 0.9637\n",
      "Epoch 37/50\n",
      "60000/60000 [==============================] - 1s 12us/step - loss: 0.0491 - acc: 0.9877 - val_loss: 0.2699 - val_acc: 0.9613\n",
      "Epoch 38/50\n",
      "60000/60000 [==============================] - 1s 14us/step - loss: 0.0361 - acc: 0.9910 - val_loss: 0.2511 - val_acc: 0.9623\n",
      "Epoch 39/50\n",
      "60000/60000 [==============================] - 1s 14us/step - loss: 0.0282 - acc: 0.9936 - val_loss: 0.2558 - val_acc: 0.9622\n",
      "Epoch 40/50\n",
      "60000/60000 [==============================] - 1s 12us/step - loss: 0.0239 - acc: 0.9950 - val_loss: 0.2460 - val_acc: 0.9622\n",
      "Epoch 41/50\n",
      "60000/60000 [==============================] - 1s 11us/step - loss: 0.0336 - acc: 0.9919 - val_loss: 0.2652 - val_acc: 0.9634\n",
      "Epoch 42/50\n",
      "60000/60000 [==============================] - 1s 12us/step - loss: 0.0289 - acc: 0.9935 - val_loss: 0.2570 - val_acc: 0.9635\n",
      "Epoch 43/50\n",
      "60000/60000 [==============================] - 1s 12us/step - loss: 0.0275 - acc: 0.9940 - val_loss: 0.2652 - val_acc: 0.9601\n",
      "Epoch 44/50\n",
      "60000/60000 [==============================] - 1s 12us/step - loss: 0.0265 - acc: 0.9944 - val_loss: 0.2464 - val_acc: 0.9661\n",
      "Epoch 45/50\n",
      "60000/60000 [==============================] - 1s 12us/step - loss: 0.0301 - acc: 0.9933 - val_loss: 0.2713 - val_acc: 0.9614\n",
      "Epoch 46/50\n",
      "60000/60000 [==============================] - 1s 12us/step - loss: 0.0336 - acc: 0.9926 - val_loss: 0.2783 - val_acc: 0.9620\n",
      "Epoch 47/50\n",
      "60000/60000 [==============================] - 1s 12us/step - loss: 0.0480 - acc: 0.9884 - val_loss: 0.2940 - val_acc: 0.9599\n",
      "Epoch 48/50\n",
      "60000/60000 [==============================] - 1s 11us/step - loss: 0.0403 - acc: 0.9904 - val_loss: 0.2574 - val_acc: 0.9651\n",
      "Epoch 49/50\n",
      "60000/60000 [==============================] - 1s 13us/step - loss: 0.0297 - acc: 0.9931 - val_loss: 0.2829 - val_acc: 0.9626\n",
      "Epoch 50/50\n",
      "60000/60000 [==============================] - 1s 13us/step - loss: 0.0381 - acc: 0.9912 - val_loss: 0.2691 - val_acc: 0.9616\n"
     ]
    }
   ],
   "source": [
    "history = model.fit(train_image,train_label,epochs=50,batch_size=512,validation_data=(test_image,test_label))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.legend.Legend at 0x1a5fc702630>"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXcAAAD8CAYAAACMwORRAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3Xt81NWd//HXJzeSECABIvdLFCp3QglgvVSUtYK11dq6\n1ba71W6ldtXqtmWL2+7299u2+3MfdruiVZFdqVW7q66tlW5xRSpq1ypXQcJFQK4BhCQQSCBALuf3\nx5nJTO4BJpnMd97Px+M8vjPf+c7M+U4m7zlzvud7xpxziIhIsKTEuwIiIhJ7CncRkQBSuIuIBJDC\nXUQkgBTuIiIBpHAXEQkghbuISAAp3EVEAkjhLiISQGnxeuL+/fu7kSNHxuvpRUQS0tq1a8ucc/nt\nbRe3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ipqeFXv/pVw/pZs2bx+OOPA1BXV8exY8e4+uqr+a//+q+G\nrqAjR46c9/M3lZjhrpa7iLSjX79+XHbZZUyYMIF58+Y1um327NnU1tYyduxY5s+fzyWXXHLez/ej\nH/2IGTNmcNlllzFmzJiG9QsWLGDFihVMnDiRqVOnsnnzZsaPH8/3v/99rrzySiZPnsy3v/3t837+\npsw5F/MH7YiioiK3Zs2ac7vzokXwjW9ASQkMGRLbiolITGzZsoWxY8fGuxoJraXX0MzWOueK2rtv\nYrfc1S0jItKixD2gagY5OfGuiYgkmbvuuou333670bp7772X22+/PU41allihnt4LndNSiQiXezR\nRx+NdxU6JHG7ZXQwVUSkVQp3EZEASsxw10/siYi0KTHDXS13EWnHuU75C/DQQw9x8uTJGNeoayVm\nuGsudxFph8I9Eekn9kSkHdFT/s6bN48HH3yQadOmMWnSJH74wx8CcOLECT796U8zefJkJkyYwPPP\nP8/DDz/MgQMHuOqqq7jqqqtaffxvfvObFBUVMX78+IbHA1i9ejWXXnopkydPZvr06VRWVlJXV8d3\nv/tdJkyYwKRJk3jkkUc6ff87NBTSzGYDC4BU4N+dcw80uX0m8DKwK7TqN865f4xhPRtTt4xIQonD\ndO488MADFBcXs379epYtW8aLL77IqlWrcM7x2c9+lrfeeovS0lIGDx7M73//e8DPOdOnTx9+9rOf\nsWLFioZZG1vyk5/8hL59+1JXV8esWbN4//33GTNmDF/84hd5/vnnmTZtGsePHycrK4tFixaxe/du\n1q9fT1paWqfMJdNUu+FuZqnAo8A1QAmw2syWOOc2N9n0j8656zuhjo2dPg1nzqjlLiIdtmzZMpYt\nW8aUKVMAqKqqYvv27VxxxRV85zvf4Xvf+x7XX389V1xxRYcf84UXXmDRokXU1tZy8OBBNm/ejJkx\naNAgpk2bBkDvUE4tX76cO++8k7Q0H7mdMcVvUx1puU8HdjjndgKY2XPADUDTcO8amjRMJOHEezp3\n5xz33391nbC3AAAGAElEQVQ/3/jGN5rdtm7dOpYuXcoPfvADZs2axT/8wz+0+3i7du3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Zq\nZu+Z2X+Hrgd+v81st5ltNLP1ZrYmtC5m+51Q4W5mqcCjwBxgHHCrmY2Lb606zVPA7Cbr5gN/cM6N\nBv4Quh40tcB3nHPjgEuAu0J/46Dv+2ngaufcZKAQmG1mlxD8/Q67F9gSdT1Z9vsq51xh1PDHmO13\nQoU7MB3Y4Zzb6Zw7AzwH3BDnOnUK59xbwJEmq28Afhm6/Evgxi6tVBdwzh10zq0LXa7E/8MPIeD7\n7ryq0NX0UHEEfL8BzGwo8Gng36NWB36/WxGz/U60cB8C7Iu6XhJalywGOOcOhi5/BAyIZ2U6m5mN\nBKYAK0mCfQ91TawHDgOvOeeSYr+Bh4C/Beqj1iXDfjtguZmtNbO5oXUx229N+ZugnHPOzAI71MnM\ncoBfA/c5546bWcNtQd1351wdUGhmucBLZjahye2B228zux447Jxba2YzW9omiPsdcrlzbr+ZXQC8\nZmZbo2883/1OtJb7fmBY1PWhoXXJ4pCZDQIILQ/HuT6dwszS8cH+K+fcb0Krk2LfAZxzFcAK/DGX\noO/3ZcBnzWw3vpv1ajN7luDvN865/aHlYeAlfLdzzPY70cJ9NTDazArMLAO4BVgS5zp1pSXAV0OX\nvwq8HMe6dArzTfQngS3OuZ9F3RTofTez/FCLHTPLAq4BthLw/XbO3e+cG+qcG4n/f37dOfcVAr7f\nZtbTzHqFLwOfAoqJ4X4n3ElMZnYdvo8uFVjsnPtJnKvUKczsP4GZ+FniDgE/BH4LvAAMx8+o+efO\nuaYHXROamV0O/BHYSKQP9u/w/e6B3Xczm4Q/gJaKb3S94Jz7RzPrR4D3O1qoW+a7zrnrg77fZnYh\nvrUOvnv8P5xzP4nlfidcuIuISPsSrVtGREQ6QOEuIhJACncRkQBSuIuIBJDCXUQkgBTuIiIBpHAX\nEQkghbuISAD9f7ViwoG8EgIiAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x1a5890cfef0>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.plot(history.epoch,history.history.get('acc'),c='r',label=\"train_acc\")\n",
    "plt.plot(history.epoch,history.history.get('val_acc'),c='b',label='test_acc')\n",
    "plt.legend()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "_________________________________________________________________\n",
      "Layer (type)                 Output Shape              Param #   \n",
      "=================================================================\n",
      "flatten (Flatten)            multiple                  0         \n",
      "_________________________________________________________________\n",
      "dense (Dense)                multiple                  50240     \n",
      "_________________________________________________________________\n",
      "dense_1 (Dense)              multiple                  4160      \n",
      "_________________________________________________________________\n",
      "dropout (Dropout)            multiple                  0         \n",
      "_________________________________________________________________\n",
      "dense_2 (Dense)              multiple                  4160      \n",
      "_________________________________________________________________\n",
      "dropout_1 (Dropout)          multiple                  0         \n",
      "_________________________________________________________________\n",
      "dense_3 (Dense)              multiple                  650       \n",
      "=================================================================\n",
      "Total params: 59,210\n",
      "Trainable params: 59,210\n",
      "Non-trainable params: 0\n",
      "_________________________________________________________________\n"
     ]
    }
   ],
   "source": [
    "model.summary()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "10000/10000 [==============================] - 0s 49us/step\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "[0.26905103086588406, 0.96160000000000001]"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "model.evaluate(test_image,test_label)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "#"
   ]
  },
  {
   "cell_type": "raw",
   "metadata": {},
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python [conda env:kr]",
   "language": "python",
   "name": "conda-env-kr-py"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
